// BrowserRouter是在开发过程中使用的，目的是为了去除url中的#
// HashRouter一般部署到线上是需要切换成HashRouter，HashRouter 是url上携带#
import { BrowserRouter as Router, Switch, Route } from "react-router-dom"
import App from '@/App'
import Home from '@/views/Home'
import Fast from '@/views/Fast'
import User from '@/views/User'
import Login from '@/views/Login'
import Register from '@/views/Register'
import Choose from '@/views/Choose'
import Practice from '@/views/Practice'
import ChangeSubject from '@/views/ChangeSubject'

const BaseRouter = () => {
  return (
    <Router>
      <Switch>
        <Route
          path="/"
          component={() => {
            return (
              <App>
                <Switch>
                  <Route exact path="/home" component={Home}></Route>
                  <Route exact path="/fast" component={Fast}></Route>
                  <Route exact path="/user" component={User}></Route>
                  <Route exact path="/login" component={Login}></Route>
                  <Route exact path="/register" component={Register}></Route>
                  <Route exact path="/choose/:code" component={Choose}></Route>
                  <Route exact path="/practice" component={Practice}></Route>
                  <Route exact path="/changesubject" component={ChangeSubject}></Route>
                </Switch>
              </App>
            )
          }}
        ></Route>
      </Switch>
    </Router>
  )
}

export default BaseRouter